﻿using System.Windows;
using Microsoft.Win32;

namespace ChatClient.Services
{
    public class DialogService : IDialogService
    {
        public string OpenFile(string caption, string filter = "All files (*.*)|*.*")
        {
            var dialog = new OpenFileDialog
            {
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures),
                Title = caption,
                Filter = filter,
                CheckFileExists = true,
                CheckPathExists = true,
                RestoreDirectory = true
            };

            return dialog.ShowDialog() == true ? dialog.FileName : string.Empty;
        }

        public bool ShowConfirmationRequest(string message, string caption = "")
        {
            var result = HandyControl.Controls.MessageBox.Ask(message, caption);
            return result.HasFlag(MessageBoxResult.OK);
        }

        public void ShowNotification(string message, string caption = "")
        {
            HandyControl.Controls.MessageBox.Info(message, caption);
        }
    }
}
